package com.ykq.core.vo;

import lombok.Data;

/**
 * @Author: 闫克起
 * @Description:
 * @Date: Create in 10:48 2024/8/12
 */
@Data
public class R<T>{
    private Integer code;
    private String msg;
    private T data;
    public static <T> R<T> ok(T data){
        R<T> r = new R<>();
        r.setCode(200);
        r.setData(data);
        r.setMsg("操作成功");
        return r;
    }
    public static <T> R<T> ok(){
        R<T> r = new R<>();
        r.setCode(200);
        r.setMsg("操作成功");
        return r;
    }

    public static <T> R<T> error(String msg){
        R<T> r = new R<>();
        r.setCode(500);
        r.setMsg(msg);
        return r;
    }
}
